using UnityEngine;
using System.Collections;

public class ApplyButton : MonoBehaviour {

	void Update(){
		if(THistory.Instance.isUndoing()){
			gameObject.GetComponent<UIButton>().isEnabled = true;
		}else{
			gameObject.GetComponent<UIButton>().isEnabled = false;
		}
	}
	
	void OnClick(){
		if(!LevelHandler.Instance.allCorrect()){
			StatsHandler.Instance.addCanceledUndo();	
		}
		
		GhostsHandler.Instance.cleanGhosts();
		THistory.Instance.exitUndoing();
	}	
}
